package com.mohan.system.auth.controller;

import com.mohan.calligraphy.dto.SystemUserRegistry;
import com.mohan.calligraphy.result.R;
import com.mohan.system.auth.service.AuthService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.ServletResponse;
import java.io.IOException;

@RestController
@RequestMapping("/manage/auth")
public class AuthController {
    @Resource
    private AuthService authService;

    @PostMapping("/login")
    public R login(SystemUserRegistry userRegistry) {
        authService.login(userRegistry);
        return R.ok();
    }

    @GetMapping("/getLoginImageCode")
    public void getLoginImageCode(String uuid, ServletResponse response) throws IOException {
        authService.getLoginImageCode(uuid,response);
    }
}
